<%@include file="template/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${website} || Manage Questions</title>
        ${stylesheet}
        ${jquery}
        ${jsdropdown}
    </head>
    <body>
        <div class="container">
            <%@include file="template/header.jsp" %>
            <div class="content">
                <h1>Manage Questions</h1>
                <h3>
                    <c:choose>
                        <c:when test="${Questionsedit!=null}">Edit</c:when>
                        <c:otherwise>Add</c:otherwise>
                    </c:choose>question in ${quiz.name}
                </h3>

                <c:choose>
                    <c:when test="${Questionedit==null}">                        
                        <form action="ManageQuizQuestion" method="POST" name="Questionadd">                    
                            <input type="hidden" name="formoption" value="Questionadd"/>
                        </c:when>
                        <c:otherwise>
                            <form action="ManageQuizQuestion" method="POST" name="Questionedit">                    
                                <input type="hidden" name="formoption" value="Questionedit"/>
                                <input type="hidden" name="qid" value="${Questionedit.id}"/>
                            </c:otherwise>                    
                        </c:choose>
                        <label for="name">Question</label> 
                            <input type="text" name="name" id="name" value="${Questionedit.name}" required/>
                            Check correct answer
                            </br>
                        <label>Option 1</label> 
                            <input type="text" name="option1" id="option" value="${Option1.value}" required/>
                            <input type="radio" name="correct" value="1" checked>
                        </br>                        
                        <label>Option 2</label> 
                            <input type="text" name="option2" id="option" value="${Option2.value}" required/>
                            <input type="radio" name="correct" value="2" >
                        </br>
                        <label>Option 3</label> 
                            <input type="text" name="option3" id="option" value="${Option3.value}"/>
                            <input type="radio" name="correct" value="3" >
                            </br>                        
                        <label>Option 4</label> 
                            <input type="text" name="option4" id="option" value="${Option4.value}"/>
                            <input type="radio" name="correct" value="4" >
                            </br>
                         <label>Explanation</label> 
                            <textarea id="description" required name="explanation">${Questionedit.explanation}</textarea>
                            <input type="hidden" name="quizid" value="${quiz.id}"/>
                            </br>
                        <label>&nbsp;</label> 
                            <input type="submit" value="Save question"/>
                    </form>
                 
            </div>
            <%@include file="template/footer.jsp" %>
        </div>
    </body>
</html>